#!/bin/sh

# This script has 2 reasons to exist.
# 1) Run the real executable, since it looks for the plugins in the same 
#    directory where it is located; therefore, the file structure given 
#    by the epsxe team must be preserved.
# 2) Check if the user's $HOME has a ".epsxe" directory. This is only a way 
#    to have links to the plugins directory, that was given write permissions
#    to the games group.

# Check for the $HOME/.epsxe dir.
if [ ! -d $HOME/.epsxe ]; then
  mkdir -p $HOME/.epsxe
  cd $HOME/.epsxe
    ln -s @INSTALLDIR@/cfg cfg
    ln -s @INSTALLDIR@/bios bios
    ln -s @INSTALLDIR@/cheats cheats
    ln -s @INSTALLDIR@/memcards memcards
    ln -s @INSTALLDIR@/plugins plugins
  cd -
fi

# Run the program
@INSTALLDIR@/epsxe

